<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>循环渲染列表</title>
</head>
<body>
<div id="app">
  <ul>
    <li v-for="(item, index) in array">{{index + 1}} {{item.city}}</li>
  </ul>
  <template v-for="(item, index) in array">
    <li>{{index + 1}}</li>
    <li>{{item.city}}</li>
  </template>

  <ul>
    <li v-for="item in object">{{item}}</li>
  </ul>
  <ul>
    <li v-for="(value, name, key) in object">{{name}} => {{key+1}} ==> {{value}}</li>
  </ul>

  <span v-for="n in 10">{{n}}-</span>

  <!-- 过滤器-->
  <template v-for="item in array">
    <li v-if="item.city !== '广州'">{{item.city}}</li>
  </template>
</div>

<script src="../vue.global.js"></script>
<script>
  const App = {
    data(){
      return {
        array: [
          {city: '北京'},
          {city: '上海'},
          {city: '深圳'},
          {city: '广州'},
        ],
        object: {
          name: "Mr.Huang",
          gender: "男",
          age: 99,
        }
      }
    }
  }

  const vm = Vue.createApp(App).mount('#app');
  console.log(vm)
</script>
</body>
</html>
